
/*
 * Copyright 2008 Friendster Inc.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
 
 * Unless required by applicable law or agreed to in writing, 
 * software distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.Text;

namespace Friendster.Service
{
    /// <summary>
    /// This Class represents instance of all the service classes.
    /// Thru this user's can access all the API services.
    /// </summary>
    public sealed class FriendsterService
    {
        // Fields
        private string _session;
        private UsersService _userService;
        private FriendsService _friendsService;
        private PhotosService _photosService;
        private ShoutoutService _shoutoutService;
        private WidgetService _widgetService;
        private FansService _fanService;
        private NotificationsService _notification;
        private const string FriendsterProfileUrl = "http://www.friendster.com/user.php";
        private const string FriendsterUrl = "http://www.friendster.com";

        // Methods
        /// <summary>
        /// Constructor. Attaches the service class with given session. Usually the current session.
        /// </summary>
        /// <param name="session"></param>
        public FriendsterService(string session)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            this._session = session;
        }
        /// <summary>
        /// Returns the current Session value.
        /// </summary>
        public string Session 
        {
            get
            {
                return this._session;
            }
        }
        /// <summary>
        /// Returns the user profile URL.
        /// </summary>
        public string UserProfileUrl 
        {
            get
            {
                return FriendsterProfileUrl;
            }
        }
        /// <summary>
        /// Represents the instance of UsersService Class.
        /// </summary>
        public UsersService Users 
        {
            get
            {
                if (this._userService == null)
                {
                    this._userService = new UsersService(this._session);
                }
                return this._userService;
            }
        }
        /// <summary>
        /// Represents the instance of FriendsService Class.
        /// </summary>
        public FriendsService Friends
        {
            get
            {
                if (this._friendsService == null)
                {
                    this._friendsService = new FriendsService(this._session);
                }
                return this._friendsService;
            }
        }
        /// <summary>
        /// Represents the instance of PhotosService Class.
        /// </summary>
        public PhotosService Photos
        {
            get
            {
                if (this._photosService == null)
                {
                    this._photosService = new PhotosService(this._session);
                }
                return this._photosService;
            }
        }
        /// <summary>
        /// Represents the instance of ShoutoutService Class.
        /// </summary>
        public ShoutoutService Shoutout
        {
            get
            {
                if (this._shoutoutService == null)
                {
                    this._shoutoutService = new ShoutoutService(this._session);
                }
                return this._shoutoutService;
            }
        }
        /// <summary>
        /// Represents the instance of WidgetService Class.
        /// </summary>
        public WidgetService Widget
        {
            get
            {
                if (this._widgetService == null)
                {
                    this._widgetService = new WidgetService(this._session);
                }
                return this._widgetService;
            }
        }
        /// <summary>
        /// Represents the instance of FansService Class.
        /// </summary>
        public FansService Fan
        {
            get
            {
                if (this._fanService == null)
                {
                    this._fanService = new FansService(this._session);
                }
                return this._fanService;
            }
        }

        public NotificationsService Notification
        {
            get
            {
                if (this._notification == null)
                {
                    this._notification = new NotificationsService(this._session);
                }
                return this._notification;
            }
        }
    }


}
